package com.baylor.server.business.common;

import java.util.ArrayList;
import java.util.Map;
import com.baylor.server.business.util.Maps;

public class ResponseData {
	private boolean success = Boolean.TRUE;
	private int error;
	private String errorMsg_CN;
	private String errorMsg_EN;
	private String command;
	private String requestCode;
	private Object result = new Object();
	private Map<String,Object> info=Maps.newHashMap();
	
	public void addData(Object obj) {
		result = obj;
	}
	
	public void setErrMsg(int error, String errorMsg_CN , String errorMsg_EN) {
		this.success = Boolean.FALSE;
		this.error = error;
		this.errorMsg_CN = errorMsg_CN;
		this.errorMsg_EN = errorMsg_EN;
		this.result = Maps.newHashMap();
	}
	
	public void setErrArrMsg(int error, String errorMsg_CN , String errorMsg_EN) {
		this.success = Boolean.FALSE;
		this.error = error;
		this.errorMsg_CN = errorMsg_CN;
		this.errorMsg_EN = errorMsg_EN;
		this.result = new ArrayList<Object>();
	}
	
	public void setDefaultMsg(String errorMsg_CN , String errorMsg_EN) {
		this.success = Boolean.TRUE;
		this.errorMsg_CN = errorMsg_CN;
		this.errorMsg_EN = errorMsg_EN;
		this.result = Maps.newHashMap();
	}
	
	/**
	 * @return the success
	 */
	public boolean isSuccess() {
		return success;
	}



	/**
	 * @param success the success to set
	 */
	public void setSuccess(boolean success) {
		this.success = success;
	}



	/**
	 * @return the error
	 */
	public int getError() {
		return error;
	}



	/**
	 * @param error the error to set
	 */
	public void setError(int error) {
		this.error = error;
	}


	/**
	 * @return the errorMsg_CN
	 */
	public String getErrorMsg_CN() {
		return errorMsg_CN;
	}

	/**
	 * @param errorMsg_CN the errorMsg_CN to set
	 */
	public void setErrorMsg_CN(String errorMsg_CN) {
		this.errorMsg_CN = errorMsg_CN;
	}


	/**
	 * @return the requestCode
	 */
	public String getRequestCode() {
		return requestCode;
	}



	/**
	 * @param requestCode the requestCode to set
	 */
	public void setRequestCode(String requestCode) {
		this.requestCode = requestCode;
	}



	public String getCommand() {
		return command;
	}

	public void setCommand(String command) {
		this.command = command;
	}

	
	/**
	 * @return the result
	 */
	public Object getResult() {
		return result;
	}

	/**
	 * @param result the result to set
	 */
	public void setResult(Object result) {
		this.result = result;
	}

	public Map<String, Object> getInfo() {
		return info;
	}
	
	public void setInfo(Map<String, Object> info) {
		this.info = info;
	}
	
	public Map<String, Object> addInfo(String key,Object value) {
		info.put(key, value);
		return info;
	}

	/**
	 * @return the errorMsg_EN
	 */
	public String getErrorMsg_EN() {
		return errorMsg_EN;
	}

	/**
	 * @param errorMsg_EN the errorMsg_EN to set
	 */
	public void setErrorMsg_EN(String errorMsg_EN) {
		this.errorMsg_EN = errorMsg_EN;
	}
}
